<?php

namespace App\Http\Controllers\Home;

use App\Model\Column;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Spatie\Activitylog\Models\Activity;

class IndexController extends Controller
{

    //加载后台模板
public function index(Request $request){
    $columns=(new Column())->get();
//    dd($column);
    $db = Activity::orderBy('id','desc');
    if($request->query('t') == 'follow'){
        $db->whereIn('causer_in',auth ()->user ()->follower->pluck('id'));
    }
    $actives = $db ->paginate(6);
        return view('home.index.index',compact('columns','actives'));
}
}
